/**
 * 
 */
package com.feonix.designPattern.FactoryMethod.sample1.idcard;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.feonix.designPattern.FactoryMethod.sample1.framework.Factory;
import com.feonix.designPattern.FactoryMethod.sample1.framework.Product;

/**
 * @CopyRight (c)1993-2017
 * @Project common_practice
 * @Comments 请输入该类的描述
 * @NameSpace com.feonix.designPattern.FactoryMethod.sample1.idcard
 * @Author Feonixzw
 * @CreateDate 2018年1月26日
 */
public class IdCardFactory extends Factory {

	private Map owners = new HashMap();

	private int serial = 100;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.feonix.designPattern.FactoryMethod.sample1.framework.Factory#
	 * createProduct(java.lang.String)
	 */
	@Override
	protected Product createProduct(String owner) {
		return new IdCardProduct(owner, String.valueOf(serial++));
	}

	@Override
	protected void registProduct(Product product) {
		IdCardProduct idCard = (IdCardProduct) product;
		owners.put(idCard.getSerial(), idCard.getOwner());
	}

	public Map getOwners() {
		return owners;
	}

}
